package com.example.high_slope_electronic_sand_table.precipitation.controller;

import com.example.high_slope_electronic_sand_table.precipitation.dto.PrecipitationAmountMonitorDTO;
import com.example.high_slope_electronic_sand_table.precipitation.service.PrecipitationAmountMonitorService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 降水量监测设备接口
 */
@Tag(name = "降水量监测设备接口")
@RestController
@RequestMapping(value = "/high-slope")
public class PrecipitationAmountMonitorController {

    @Autowired
    private PrecipitationAmountMonitorService precipitationAmountMonitorService;

    /**
     * 查询某个设备单条降水量监测数据
     * @return
     */
    @Operation(summary = "查询某个设备单条降水量监测数据")
    @GetMapping(value = "/precipitation-amount/monitor/device/{deviceId}/data")
    public PrecipitationAmountMonitorDTO getCurrentMonitorData(@PathVariable String deviceId){
        return precipitationAmountMonitorService.getCurrentMonitorData(deviceId);
    }

    /**
     * 查询某个设备所有降水量监测数据
     * @return
     */
    @Operation(summary = "查询某个设备所有降水量监测数据")
    @GetMapping(value = "/precipitation-amount/monitor/device/{deviceId}/datas")
    public List<PrecipitationAmountMonitorDTO> listMonitorDataByDeviceId(@PathVariable String deviceId){
        return precipitationAmountMonitorService.listMonitorDataByDeviceId(deviceId);
    }

    /**
     * 查询某个设备所有降水量监测告警数据
     * @return
     */
    @Operation(summary = "查询某个设备所有降水量监测告警数据")
    @GetMapping(value = "/precipitation-amount/monitor/device/{deviceId}/warning/datas")
    public List<PrecipitationAmountMonitorDTO> listWarningMonitorDataByDeviceId(@PathVariable String deviceId){
        return precipitationAmountMonitorService.listWarningMonitorDataByDeviceId(deviceId);
    }

    /**
     * 查询多条降水量监测数据
     * @return
     */
    @Operation(summary = "查询多条降水量监测数据")
    @GetMapping(value = "/precipitation-amount/monitor/datas")
    public List<PrecipitationAmountMonitorDTO> listMonitorData(){
        return precipitationAmountMonitorService.listMonitorData();
    }
}
